package com.jic.interaction.hereWeGo.service.impl;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.jic.common.base.vo.RestResult;
import com.jic.interaction.common.utils.HttpClientUtil;
import com.jic.interaction.hereWeGo.common.utlis.HereWeGoHttpUtil;
import com.jic.interaction.hereWeGo.model.entity.Overbooking;
import com.jic.interaction.hereWeGo.model.vo.request.OverbookingRequset;
import com.jic.interaction.hereWeGo.model.vo.response.OverbookingResponse;
import com.jic.interaction.hereWeGo.service.OverbookingService;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import java.io.IOException;
import java.util.Map;
import java.util.concurrent.ExecutionException;

@Service
@Slf4j
public class OverbookingServiceImpl implements OverbookingService {

    @Value("${route.value}")
    private String url;


    /**
     * @Author: lixuehui
     * @param requset
     * @return 下单成功会返回嘿we购的订单号
     * @throws InterruptedException
     * @throws ExecutionException
     * @throws IOException
     */
    @Override
    public RestResult<JSONObject> overbookingBuy(OverbookingRequset requset) throws Exception {
        log.info("下单信息开始：请求参数{}", requset.toString());
        String url=this.url+"/mall/order/"+requset.getAccount()+"/buy";
   //     Map<String,String> parem = JSON.parseObject(JSON.toJSONString(requset), Map.class);
//        String result = HereWeGoHttpUtil.doRequestPost(url, parem);
//        if(result.isEmpty()){
//            return RestResult.error("9999","请求失败");
//        }
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("hwg_order_id","hwg202012041636");
        return RestResult.success(jsonObject);
    }
}
